home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / public / fax / src / libtiff / tif_warning.c < prev    next >
C/C++ Source or Header  |  1994-08-01  |  2KB  |  66 lines

  1. #ifndef lint
  2. static char rcsid[] = "$Header: /usr/people/sam/tiff/libtiff/RCS/tif_warning.c,v 1.15 92/10/21 13:42:23 sam Rel $";
  3. #endif
  4.  
  5. /*
  6.  * Copyright (c) 1988, 1989, 1990, 1991, 1992 Sam Leffler
  7.  * Copyright (c) 1991, 1992 Silicon Graphics, Inc.
  8.  *
  9.  * Permission to use, copy, modify, distribute, and sell this software and 
  10.  * its documentation for any purpose is hereby granted without fee, provided
  11.  * that (i) the above copyright notices and this permission notice appear in
  12.  * all copies of the software and related documentation, and (ii) the names of
  13.  * Sam Leffler and Silicon Graphics may not be used in any advertising or
  14.  * publicity relating to the software without the specific, prior written
  15.  * permission of Sam Leffler and Silicon Graphics.
  16.  * 
  17.  * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
  18.  * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
  19.  * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
  20.  * 
  21.  * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
  22.  * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
  23.  * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  24.  * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
  25.  * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
  26.  * OF THIS SOFTWARE.
  27.  */
  28.  
  29. /*
  30.  * TIFF Library.
  31.  */
  32. #include "tiffiop.h"
  33. #include <stdio.h>
  34.  
  35. static void
  36. DECLARE3(defaultHandler, const char*, module, const char*, fmt, va_list, ap)
  37. {
  38.     if (module != NULL)
  39.         fprintf(stderr, "%s: ", module);
  40.     fprintf(stderr, "Warning, ");
  41.     vfprintf(stderr, fmt, ap);
  42.     fprintf(stderr, ".\n");
  43. }
  44.  
  45. static TIFFErrorHandler _warningHandler = defaultHandler;
  46.  
  47. TIFFErrorHandler
  48. DECLARE1(TIFFSetWarningHandler, TIFFErrorHandler, handler)
  49. {
  50.     TIFFErrorHandler prev = _warningHandler;
  51.     _warningHandler = handler;
  52.     return (prev);
  53. }
  54.  
  55. void
  56. /*VARARGS2*/
  57. DECLARE2V(TIFFWarning, const char*, module, const char*, fmt)
  58. {
  59.     if (_warningHandler) {
  60.         va_list ap;
  61.         VA_START(ap, fmt);
  62.         (*_warningHandler)(module, fmt, ap);
  63.         va_end(ap);
  64.     }
  65. }
  66.